
<!DOCTYPE HTML PUBLIC "-//W3C//DTD -//W3C//DTD HTML 4.01//EN//EN" "">
<%@ page contentType="text/html; charset=utf-8" %>
<%@page import="controller.Controller"%>
<%@ page import="java.util.*,dataBase.*"%>
<%@page import="com.google.appengine.api.datastore.Key"%>
<%@page import="sessionMenegment.SessionMgr"%>
<%@page import="language.LangFactory"%>
<%@page import="language.LangIntrf"%>

<%
	SessionMgr sessionMgr = SessionMgr.getInst();
	boolean user = sessionMgr.checkUser(request,session);
	if(!user)
		response.sendRedirect("home.jsp");
%>
<%
	LangFactory langFactory= new LangFactory();
	String langName = request.getParameter("lang");

	LangIntrf lang =null;
	if(langName!=null){
		lang = langFactory.getLang(request.getParameter("lang"));
		session.setAttribute("lang",langName);
	}
	else
		lang = langFactory.getLang((String)session.getAttribute("lang"));
	String langSign = lang.getLang();
	
	
%>
<html>

	<head>
        <% 
        	
    	Controller controller = Controller.getInstance();
    	Business business =  controller.getBiz((String)session.getAttribute("userNameBusiness"));
    	if(business==null){
    		response.sendRedirect("home.jsp");
    	}
    	String orderNum = request.getParameter("orderNum");
    	Order order = controller.getOrder(Integer.parseInt(orderNum),business.getUserName());
    	String currentStatus = controller.getCurrentStatusOfOrder(order);
        %>
        
    <style type="text/css">
    	.details{
    		padding-left: 30px;
    		display: block;
    	}
    	label{
    		font-size: 20px;
    		font-weight: bold;
    	}
    </style>  
	</head>

	<body dir="<%=lang.getDirection() %>" style="text-align: <%=lang.getAlign()%>;">
		<%if (business.getLogoPic()!=null){ %>
			<img src="../showImage?imageKey=<%=business.getUserName() %>" width="150" /><br>
		<% }%>
		<br>
		<label><%=lang.getDETAILS_PRINT_LABEL() %></label><br><br>
		<div class="details" align="<%=lang.getAlign() %>"  dir="<%=lang.getDirection()%>">
			<table>
				<tr>
					<td><%=lang.getORDER_NUBER_LABEL() %> </td>
					<td><%=order.getOrderNum() %></td>
				</tr>
				<tr>
					<td><%=lang.getCURRENT_STATUS_LABEL() %></td>
					<td><%= currentStatus %></td>
				</tr>
				<tr>
					<td><%=lang.getDEST_ADDRESS_LABEL() %> </td>
					<td><%= order.getDestAdd() %></td>
				</tr>
				<tr>
					<td><%=lang.getPHONE_NUMBER_LABEL() %></td>
					<td><%= order.getPhoneNumber().getNumber() %></td>
				</tr>
				<tr>
					<td><%=lang.getEMAIL_LABEL()%></td>
					<td><%= order.getEmail() %></td>
				</tr>
				<tr>
					<td><%=lang.getDETAILS_LABEL() %></td>
					<td><%= order.getDetails() %></td>
				</tr>
			</table>

		</div><br/>
		<label><%=lang.getBUSINESS_DETAILS_PRINT_LABEL() %></label><br/><br/>
		<div class="details"  align="<%=lang.getAlign() %>"  dir="<%=lang.getDirection()%>">
			<table>
				<tr>
					<td><%=lang.getPHONE_NUMBER_LABEL() %></td>
					<td><%= business.getPhoneNumber().getNumber() %></td>
				</tr>
				<tr>
					<td><%=lang.getEMAIL_LABEL() %></td>
					<td><%= business.getEmail().getEmail() %></td>
				</tr>
				
				<tr>
					<td><%=lang.getBUSINESS_WEBSITE_LABEL() %></td>
					<td><a href="<%=business.getWebsite() %>"><%= business.getWebsite() %></a></td>
				</tr>
			</table>
	
		</div><br/>
		<label><%=lang.getTRACK_PRINT_LABEL() %></label>
		<div class="details" style="text-align: <%=lang.getAlign()%>;">
			
			<%=lang.getDIRECTLY_PRINT_LABEL() %><br/>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=Controller.getInstance().getSyncaWebAddress()%>/showOneOrder.jsp?orderNum=<%=orderNum %>&bizName=<%=business.getUserName() %>&phone=<%=order.getPhoneNumber().getNumber()%>"><%=Controller.getInstance().getSyncaWebAddress()%>/showOneOrder.jsp?orderNum=<%=orderNum %>&bizName=<%=business.getUserName() %>&phone=<%=order.getPhoneNumber().getNumber()%></a>
			<br/>
			<img src='http://chart.apis.google.com/chart?cht=qr&chs=200x200&chl=<%=Controller.getInstance().getSyncaWebAddress()%>/showOneOrder.jsp?orderNum=<%=orderNum %>%26bizName=<%=business.getUserName() %>%26phone=<%=order.getPhoneNumber().getNumber()%>'/><br/>
			
			<%=lang.getSYNCA_SITE_PRINT_LABEL() %><br/>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<%=Controller.getInstance().getSyncaWebAddress()%>"><%=Controller.getInstance().getSyncaWebAddress()%></a>
			
		</div>
		<br/>
		<button onclick="window.print();"><%=lang.getPRINT_LABEL()%></button>
		<br/>
			<%=lang.getPOWERED_BY_LABEL() %><img src="../images/logo2.png" width="50px">
	</body>

</html>
